package com.xh.baselibrary.tts

import java.util.*

class TTSRequest(val text: String, val priority: Int = 0, val ttsPlayCallback: TTSPlayCallback? = null) {
    //是否需要打断当前播报->只有当优先级大于或等于当前正在播放的TTS时，才起效
    var isBreaking = false

    //异常信息
    lateinit var exception: TTSException

    //TTS唯一ID
    val ID = UUID.randomUUID().toString()

    @Volatile
    var isCancel: Boolean = false

    @Volatile
    var isFinish: Boolean = false
    override fun toString(): String {
        return text
    }

    var ttsEngine: TTSEngine? = null
    fun cancel(){
        ttsEngine?.apply {
            cancelRequest(this@TTSRequest)
        }
    }
}